Skip to content

nomad: read remote git compose over SSH; support ${VAR:?} and nested defaults - #31

Open
pipozzz wants to merge 1 commit into
mainfrom
fix/nomad-compose-remote-read
Open

pipozzz wants to merge 1 commit into
mainfrom
fix/nomad-compose-remote-read

Conversation

@pipozzz

@pipozzz pipozzz commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Problem

  1. A git-sourced compose service deployed to a remote server failed with No services found in compose file. getBuildNomadCommand only read the cloned compose file when there was no serverId. On a remote server it fell back to the stored composeFile snapshot, and for git sources that snapshot is always "".
  2. substituteEnvVars handled only ${VAR}, ${VAR:-x} and ${VAR-x}.

Fix

  • Remote server: read the cloned file over SSH (execAsyncRemote + cat). If the file is missing or empty, throw a clear error that names the compose path and the server.
  • Interpolation: added ${VAR:?msg} / ${VAR?msg}, which fail the deploy with the message, and nested defaults such as ${A:-${B:-x}}. The parser is now a small scanner instead of a regex, so nested braces work. Existing forms behave as before.

Tests

  • __test__/nomad/nomad-env-substitution.test.ts: existing forms, nested defaults, :? and ?.
  • __test__/nomad/nomad-remote-compose.test.ts: the remote compose read (with a mocked execAsyncRemote) and the clear error.
  • The full suite passes (536 tests). packages/server typecheck is clean, and apps/dokploy typecheck shows no new errors.

…faults

- getBuildNomadCommand: for a git-sourced compose on a remote server, read the
  cloned compose file over SSH instead of the stored snapshot (always "" for
  git sources → "No services found in compose file"). Clear error naming the
  compose path + server when the file is missing/empty.
- substituteEnvVars: add ${VAR:?msg} / ${VAR?msg} (fail the deploy) and nested
  defaults like ${A:-${B}}; existing forms unchanged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant